package com.eneat.smartrule.model;


import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rule extends BaseModel{

    @Schema(description = "规则名称")
    @NotBlank(message = "规则名称不能为空")
    private String name;

    @Schema(description = "规则表达式，是根据条件列表解析而来的，而不是传进来的")
    private String expression;

    @Schema(description = "条件列表")
    @NotEmpty(message = "规则条件列表不能为空")
    @TableField(exist = false)
    private List<RuleCondition> ruleConditions;

    @Schema(description = "命中后的动作，暂时未启用")
    @TableField(exist = false)
    private RuleAction successRuleAction;

    @Schema(description = "未命中的动作,暂时未启用")
    @TableField(exist = false)
    private RuleAction failRuleAction;

}

